UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cv7nUBqYzErYz/nC47761YSHtnS3wJBnWdW+nqKqy9s=' 
WHERE 
  key_id = 'e6ee15f8ed319c8eded684808915cc640c747119dbf0d33db42e468159dc28ad' 
  AND (
    token = 'cv7nUBqYzErYz/nC47761YSHtnS3wJBnWdW+nqKqy9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054