UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'za4DYAP3M0q+bg0K95971/XVNUBo7kWHG/EieDzWHHY=' 
WHERE 
  key_id = 'ba47607a13e8f65865afe923a86106e5f744d80c3b0aa1bda77aa1fd01ff6e2a' 
  AND (
    token = 'za4DYAP3M0q+bg0K95971/XVNUBo7kWHG/EieDzWHHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018