UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o/kdzzlCWTxjZEGh85qjQ3SBTRk9w0xY4yJS1LEHDPs=' 
WHERE 
  key_id = '588a915a39f03f6784f521c880c6a8b9406ee0585ac314171b2837fb0bf513f4' 
  AND (
    token = 'o/kdzzlCWTxjZEGh85qjQ3SBTRk9w0xY4yJS1LEHDPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034