UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oJ3Cow1MBxFg9l7URBvvKaEthO0Ho1dk5JcbSiKWIB0=' 
WHERE 
  key_id = 'b1e09b8901f85b80fc9730c1d21214989170dc560b6a889a874f32b8d8b1827d' 
  AND (
    token = 'oJ3Cow1MBxFg9l7URBvvKaEthO0Ho1dk5JcbSiKWIB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026