UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BI/S86b/mz45TNqikVGs6cDQyaoXfG3bUygz42ddfkA=' 
WHERE 
  key_id = 'b0787cded031da223295ec48ba028e5af2b25d70c23bbced464e7c3d6b4dbf3d' 
  AND (
    token = 'BI/S86b/mz45TNqikVGs6cDQyaoXfG3bUygz42ddfkA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043