UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/Ez7DLqDBXOv3WYi9LvMje05P141GWmpmhANyU0pXh8=' 
WHERE 
  key_id = '8fb8a0bfe0b4a31a39fb981e7a432469934d24823b1010677f6cbcff2b497667' 
  AND (
    token = '/Ez7DLqDBXOv3WYi9LvMje05P141GWmpmhANyU0pXh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038