UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K1lAI0IXptK8rsIwFvkgpfruMO8Q6pdej/2poGsBYvo=' 
WHERE 
  key_id = '8c4fe999ce8330f5a51922ccf848e67fcfd0b48d9fa109600d06f229319582f1' 
  AND (
    token = 'K1lAI0IXptK8rsIwFvkgpfruMO8Q6pdej/2poGsBYvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049