UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IT11zbMRMj+OuYdWCwTybkXokRdTFv1tSLtPvD1GNm0=' 
WHERE 
  key_id = '22185c9c3ef49d0f231132fab96cba1bfa53cee1e34aec591c1082b457a3a43d' 
  AND (
    token = 'IT11zbMRMj+OuYdWCwTybkXokRdTFv1tSLtPvD1GNm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040