UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RXOVmMfUOF1fCxvOg38W4diU7N1M5ToFOdK7np0fYrw=' 
WHERE 
  key_id = '17b49dbf3aeb9302376849c597fca1d499ea42a2ab982f7907d6a86dab5d4789' 
  AND (
    token = 'RXOVmMfUOF1fCxvOg38W4diU7N1M5ToFOdK7np0fYrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025