UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c6w7tKD11BJ8Xsn4Hu4Z+jylDw7GrlyzSdexsilIghM=' 
WHERE 
  key_id = 'cc898cd1347b86ef1594e00b847de885b81803182485f011852097d4c82eca54' 
  AND (
    token = 'c6w7tKD11BJ8Xsn4Hu4Z+jylDw7GrlyzSdexsilIghM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029