UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3liLs+r95nDxsVrzQn4gvU5c5JTZXQIBI4b7atNs8gY=' 
WHERE 
  key_id = 'b520b6ab9595b82f8bd186bb7e83f2d648a86b659e5d716fcbb14c98a965f7b3' 
  AND (
    token = '3liLs+r95nDxsVrzQn4gvU5c5JTZXQIBI4b7atNs8gY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044