UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'McqUTgXRRKzNMbmeT1AbbQlo3/8AyopAEePAg89I2Yc=' 
WHERE 
  key_id = '1619c919905ba3fa666332eee55c5d46e0cde61e72efbca65f6ec1b46bb41622' 
  AND (
    token = 'McqUTgXRRKzNMbmeT1AbbQlo3/8AyopAEePAg89I2Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040