UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tm8mZtS12lBTQHMtkxoz/WP8pDmNvPLfWzmu7KZxMIc=' 
WHERE 
  key_id = 'bf8b57aacfa6a849d76003513ded68901e84c5fc101a54478632100a479e3295' 
  AND (
    token = 'Tm8mZtS12lBTQHMtkxoz/WP8pDmNvPLfWzmu7KZxMIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046