UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xzEMso/SCW5tAefxIIt0P+GCVu4RDvzOgIRNhAE/wJs=' 
WHERE 
  key_id = '9558782da156c7067ca4fdcbd7a8064db60b2b242a44f22c0c006f36b30a8fc2' 
  AND (
    token = 'xzEMso/SCW5tAefxIIt0P+GCVu4RDvzOgIRNhAE/wJs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034