UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UhydW+Rm9OMnFa6EY7P+2vh919RhSj13HP9+dzluLhQ=' 
WHERE 
  key_id = '0f8a25aed28a92aa016f0e282837299c1a3333d91c86daaa990bc6f0aad819f3' 
  AND (
    token = 'UhydW+Rm9OMnFa6EY7P+2vh919RhSj13HP9+dzluLhQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027