UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TtMKEiBfnckYSfs0w8+U7Lst/vI3BjxmM41BZ1p0Lus=' 
WHERE 
  key_id = '679bec9866226a1a31f699913a3c8be5b0c3ed841b4307e03f477c569baf5b54' 
  AND (
    token = 'TtMKEiBfnckYSfs0w8+U7Lst/vI3BjxmM41BZ1p0Lus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024