UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cAVmFJOxMtm2ygzgNDJVR20s9EGeap3Z/2iSXQ+aeoI=' 
WHERE 
  key_id = '2d55da1f22b5c6c1f1573add8639c5489309898f97d7818cd7c9553c40dde87f' 
  AND (
    token = 'cAVmFJOxMtm2ygzgNDJVR20s9EGeap3Z/2iSXQ+aeoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028