UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm0TdPEeEybh0azHakbymV0y7Jt+G63h7BBxMCxmDVBs=' 
WHERE 
  key_id = '267e603e2ab143b937742bb5904df3da44ff244673a78113c8111117061458f1' 
  AND (
    token = 'm0TdPEeEybh0azHakbymV0y7Jt+G63h7BBxMCxmDVBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030