UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qD0krLelxd5bP47+CPzKnT97134aWYPdpunU93sgab4=' 
WHERE 
  key_id = '9a37f274acde7c90a14677ff7ea9c827305e61cf9f040ce78cdef4db778fcdfc' 
  AND (
    token = 'qD0krLelxd5bP47+CPzKnT97134aWYPdpunU93sgab4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023