UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xrr8eox8AyStdZiQ/x5Cxx7xE6ysbQ5OfpXX1OobRxc=' 
WHERE 
  key_id = '60d9f997fadd34e09ea9ca3d304755fce25237317f2dc0b3cbb9e4e8b7808928' 
  AND (
    token = 'Xrr8eox8AyStdZiQ/x5Cxx7xE6ysbQ5OfpXX1OobRxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031