UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TGkk6GvywftecvhW+pHReHZ1HfZJEq1q3di9maaR0SY=' 
WHERE 
  key_id = '768f9cea3cd2ef7a022693d4f1d79165b87d7906cc3fc120a955379564202261' 
  AND (
    token = 'TGkk6GvywftecvhW+pHReHZ1HfZJEq1q3di9maaR0SY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027