UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qcjO0vGyEBHm3Ty/56ONTx/1fa2bHUq39/Ve7mWlVtQ=' 
WHERE 
  key_id = 'b5a958073d2d53396d8c8319752caa6771360e2733e0bff319323964ecb9f559' 
  AND (
    token = 'qcjO0vGyEBHm3Ty/56ONTx/1fa2bHUq39/Ve7mWlVtQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043